/* ************************************************************************ */
/*                                                                          */
/*  Copyright (c)2005 Russell Weir | damonsbane _at_ gmail                  */
/*                                                                          */
/* This library is free software; you can redistribute it and/or            */
/* modify it under the terms of the GNU Lesser General Public               */
/* License as published by the Free Software Foundation; either             */
/* version 3.0 of the License, or (at your option) any later version.       */
/*                                                                          */
/* This library is distributed in the hope that it will be useful,          */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of           */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        */
/* Lesser General Public License or the LICENSE file for more details.      */
/*                                                                          */
/* ************************************************************************ */

package tzparser;
import altdate.TimeSpecification;

class Rule {
	public var name 		: String;
	public var validFromYear 	: Int;  // 'min' and 'max' are statics
	// the only 'until' about this Until is the year. The
	// rest is the inMonth, onDay, atTime of when this rule
	// takes effect for any given year.
	public var until 		: Until;
	public var save 		: TimeSpecification; // seconds added to local time when rule in effect
	public var letter 		: String;

	public static var MAXYEAR	: Int	= 10000;
	public static var MINYEAR	: Int	= -10000;

	public function new() {
		name = "";
		validFromYear = MINYEAR;
		/*
		validToYear = MAXYEAR;
		inMonth = 0;
		onDay = new DaySpecification();
		atTime = new TimeSpecification();
		*/
		until = new Until();
		until.year = MAXYEAR;
		save = new TimeSpecification();
		letter = "";
	}

	public function isActiveForYear(year:Int) : Bool {
		if(validFromYear == MINYEAR || validFromYear <= year)
			if(until.year == MAXYEAR || until.year >= year)
				return true;
		return false;
	}
}
